import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
import { StoreStockItem } from './storeStockItem';
@Define.Table({ TableName: 'storestock' })
export class StoreStock extends EntityObjectType<StoreStock> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    productId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    productName: string;

    @Define.Column({
        DataType: Define.DataType.Decimal,
        DataLength: 11,
        DecimalPoint: 3,
        NotAllowNULL: true
    })
    inventory: number;

    @Define.Column({
        DataType: Define.DataType.BOOL
    })
    autoSellClear: boolean;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    status: string;

    @Define.Column({
        DataType: Define.DataType.BOOL,
        DefaultValue: 0,
    })
    disable: boolean;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;

    @Define.Mapping({
        Mapping: 'StoreStockItem',
        MappingKey: 'stockId'
    })
    storeStockItems: StoreStockItem[];
}

export const StoreStockStatus = {
    Normal: 'normal',
    SoldOut: 'soldOut'
}